The RapidSpellChecker class is of particular use in non-GUI scenarios, however it can also be used with custom spell checker interfaces. Below is a very simple excerpt of how this component can be used, please consult the API documentation for further detail.
.........
RapidSpellChecker c = new RapidSpellChecker("...license key...");
BadWord badWord;
ArrayList suggestions;
//check some text.
c.Check("This is sume text.");
//iterate through all bad words in the text.
while((badWord = c.NextBadWord())!=null){
Console.WriteLine(badWord.GetWord() +
"- is not spelt correctly. Suggestions:");
try{
//get suggestions for the current bad word.
suggestions = c.FindSuggestions();
//display all suggestions.
for(int i=0; i<suggestions.Count; i++){
Console.WriteLine(suggestions[i]);
}
//change the bad word in the text with "replacement".
c.ChangeBadWord("replacement");
} catch (NoCurrentBadWordException e){
Console.WriteLine(e);
}
}
Console.WriteLine(c.GetAmendedText());
.........
VB.NET
imports Microsoft.VisualBasic
imports System
Imports System.Collections
Imports Keyoti.RapidSpell
........
Dim c As RapidSpellChecker = New RapidSpellChecker("...license key...")
Dim badWord As BadWord
Dim suggestions As ArrayList
'check some text.
c.Check("This is sume text.")
'iterate through all bad words in the text.
badWord = c.NextBadWord()
while Not badWord Is Nothing
Console.WriteLine((badWord.GetWord + "- is not spelt correctly.
Suggestions:"))
Try
'get suggestions for the current bad word.
suggestions = c.FindSuggestions
'display all suggestions.
Dim i As Integer = 0
Do While (i < suggestions.Count)
Console.WriteLine(suggestions(i))
i = (i + 1)
Loop
'change the bad word in the text with "replacement".
c.ChangeBadWord("replacement")
badWord = c.NextBadWord()
Catch e As NoCurrentBadWordException
Console.WriteLine(e)
End Try
End while
Console.WriteLine(c.GetAmendedText)
.........